package com.flyme.module.base.provider.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.flyme.common.core.model.query.CriteriaQuery;
import com.flyme.common.core.model.query.PagerInfo;
import com.flyme.common.core.model.query.PqGrid;
import com.flyme.core.base.supper.entity.EntityMap;
import com.flyme.core.base.supper.service.impl.BaseServiceImpl;
import com.flyme.module.base.client.entity.SysHtml;
import com.flyme.module.base.provider.mapper.SysHtmlMapper;
import com.flyme.module.base.provider.service.SysHtmlService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * @author: zyf
 * @date: 2018/10/24 16:33
 * @description:
 */
@Service
@Transactional(rollbackFor = Exception.class)
public class SysHtmlServiceImpl extends BaseServiceImpl<SysHtmlMapper, SysHtml> implements SysHtmlService {

    /**
     * 查询静态页面
     */
    public SysHtml findByHtmlKey(String htmlCode) {
        QueryWrapper queryWrapper = new QueryWrapper<SysHtml>();
        queryWrapper.eq("htmlCode", htmlCode);
        queryWrapper.eq("htmlStatus", 1);
        return getOne(queryWrapper);
    }

    /**
     * 网站的帮助中心
     */
    public PqGrid selectListWeb(PagerInfo pagerInfo){
        CriteriaQuery queryWrapper = new CriteriaQuery<EntityMap>(pagerInfo);
        queryWrapper.select("*");
        queryWrapper.eq("parentId", 2);
        PqGrid pqGrid = pageList(queryWrapper);
        return pqGrid;
    }

}
